package com.huyaanalysisplatform.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.huyaanalysisplatform.common.Result;
import com.huyaanalysisplatform.entity.TVideo;
import com.huyaanalysisplatform.service.TVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huyaanalysisplatform.controller.BaseController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Huadi Group 12
 * @since 2021-08-01
 */
@RestController
@RequestMapping("/video")
@CrossOrigin
public class TVideoController extends BaseController {

    @Autowired
    TVideoService tVideoService;

    @PostMapping("/rankOfVideo")
    public Map<String,List<TVideo>> rankOfVideo(){
        return tVideoService.rankOfVideo();
    }

    @PostMapping("/rankOfVideo/add")
    public Result add(@RequestBody TVideo tVideo){
        return tVideoService.add(tVideo);
    }

    @PostMapping("/rankOfVideo/edit")
    public Result edit(@RequestBody TVideo tVideo){
        return tVideoService.edit(tVideo);
    }

    @GetMapping("/rankOfVideo/delete")
    public Result delete(@RequestParam String id){
        return tVideoService.delete(id);
    }

}
